package com.xing.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xing.dto.LiveAttentionUserDTO;
import com.xing.entity.LiveAttentionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LiveAttentionDao extends BaseMapper<LiveAttentionEntity> {


    @Select("select id, nickname, head_url\n" +
            "from sys_user\n" +
            "where id in (select attentioned_id from live_attention where attention_id = #{userId})\n" +
            "  and sys_user.del_flag = 0;")
    List<LiveAttentionUserDTO> selectAttentionListByUserId(@Param("userId") Long userId);

    @Select("select id, nickname, head_url\n" +
            "from sys_user\n" +
            "where id in (select attention_id from live_attention where attentioned_id = #{userId})\n" +
            "  and sys_user.del_flag = 0;")
    List<LiveAttentionUserDTO> selectAttentionedListByUserId(@Param("userId") Long id);
}
